home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2008 January / Cybermycha 1_2008.iso / drappa / setup.exe / {app} / game / levels / Simus_mini / scripts / level.lcc < prev    next >
Encoding:
Text File  |  2005-08-18  |  2.5 KB  |  123 lines

  1. uint action_escape           = 0x01;
  2.  
  3.  
  4. geCRenderableObject* g_pThis = 0;
  5. geCBaseNode* g_pNode = 0;
  6.  
  7. uint g_MaxLifes = 5;
  8. int g_uiLifes = g_MaxLifes;
  9. uint g_uiShtonsCounter = 0;
  10.  
  11. bool g_bEndLevel = false;
  12. float g_fStartEndTime = 0.0f;
  13.  
  14. void IncreaseShtonsCounter( uint a_uiVal )
  15. {
  16.     g_uiShtonsCounter = g_uiShtonsCounter + a_uiVal;
  17. }
  18. void IncreaseShtonsCounter()
  19. {
  20.     IncreaseShtonsCounter(1);
  21.     //g_uiShtonsCounter = g_uiShtonsCounter + a_uiVal;
  22. }
  23. void LevelDecreaseLifes( uint NormalDeath )
  24. {
  25.     if( g_uiLifes > 0 )
  26.     {
  27.         g_uiLifes = g_uiLifes - 1;
  28.     }
  29.     if( g_uiLifes == 0 )
  30.     {
  31.         EndLevel();
  32.     }
  33. }
  34. void LevelDecreaseLifesBy( uint a_uiLifes )
  35. {
  36.     if( int(g_uiLifes)-int(a_uiLifes) >= 0 )
  37.     {
  38.         g_uiLifes = g_uiLifes - a_uiLifes;
  39.     }
  40.     else
  41.     {
  42.         g_uiLifes = 0;
  43.     }
  44.  
  45.     if( g_uiLifes == 0 )
  46.     {
  47.         EndLevel();
  48.     }
  49. }
  50.  
  51. bool LevelIncreaseLifes( uint a_uiCount )
  52. {
  53.     if( g_uiLifes >= g_MaxLifes )
  54.         return false;
  55.  
  56.     g_uiLifes += a_uiCount;
  57.     if( g_uiLifes > g_MaxLifes )
  58.         g_uiLifes = g_MaxLifes;
  59.     return true;
  60. }
  61.  
  62. void EndLevel()
  63. {
  64.     if( !g_bEndLevel )
  65.     {
  66.         GameCore->SendMessage( String("stop"), g_pNode->GetID(), g_pNode->GetID(), 666, 0 );
  67.  
  68.         geCBaseNode* pKoniecSplashNode = GameCore->GetRootNode()->GetNodeByName( String("HudKoniec") );
  69.         pKoniecSplashNode->Enable(1);
  70.         GetRenderableObject(pKoniecSplashNode)->GetAnimations()->SetActive(1);
  71.         g_bEndLevel = true;
  72.         g_fStartEndTime = -666.666f;
  73.     }
  74. }
  75.  
  76.  
  77. void geCRenderableObject_Update( geSUpdateArgument* a_pArg )
  78. {
  79.     if( g_pNode->IsFistTimeUpdate() == TRUE )
  80.     {
  81.         g_pThis->PlayMusiqueByName( String("simus_bg_music") );
  82.     }
  83.     LogToScreen( "PunktyFont", 0.1f, 0.015f, bstrFormat( g_uiLifes )  );
  84.     LogToScreen( "PunktyFont", 0.8f, 0.015f, bstrFormat( g_uiShtonsCounter )  );
  85.  
  86.     if( g_fStartEndTime == -666.666f && g_bEndLevel )
  87.     {
  88.         g_fStartEndTime = a_pArg->m_fCurrentTime;
  89.     }
  90.     else if( g_bEndLevel && a_pArg->m_fCurrentTime - g_fStartEndTime >= 5.0f )
  91.     {
  92.         g_pNode->Disable(1);
  93.                 GameCore->UnloadLevel();  
  94.         GameCore->GetRootNode()->GetNodeByName( String("MainScreen2") )->Enable(1);
  95.     }
  96.  
  97.     bool bLast = false;
  98.     if( GameCore->CheckForKey( GameCore->back_to_menu, bLast ) && !bLast /*&& !IsShowingMap()*/ )
  99.     {
  100.         EndLevel();
  101.     }
  102.     /*
  103.     if( GameCore->CheckForKey(action_escape) && !g_bEndLevel )
  104.     {
  105.         EndLevel();
  106.     }
  107.     */
  108.     
  109.     return;
  110. }
  111.  
  112. void geCRenderableObject_Process( geSUpdateArgument* a_pArg )
  113. {
  114.     return;
  115. }
  116.  
  117. void main( geCBaseNode* a_pNode )
  118. {
  119.     g_pNode = a_pNode;
  120.     g_pThis = GetRenderableObject( a_pNode );
  121. }
  122.  
  123.